﻿Public Class ListadoDevoluciones

    Private Sub ListadoPrestamos_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim reporte As New CrystalReport4
        Dim consulta As String
        Dim conexion As New OleDb.OleDbConnection

        Dim ds_local As New DataSetDevoluciones

        conexion.ConnectionString = "Provider=SQLOLEDB;Data Source=GTºN1\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=C:\DB\LIBRERIA_MAGOO.MDF"
        conexion.Open()
        Dim comando As New OleDb.OleDbCommand
        comando.Connection = conexion
        comando.CommandType = CommandType.Text

        consulta = "SELECT Cliente.num_doc as num_doc, Cliente.apellido+ ', ' + Cliente.nombre as cliente, Devoluciones.IdDevolucion as IdDevolucion, Devoluciones.ISBN as ISBN, Libro.titulo as titulo, Devoluciones.FechaDevolucion FROM Cliente, Devoluciones, Libro where Cliente.id_cliente = Devoluciones.IdCliente and Libro.ISBN = Devoluciones.ISBN"

        comando.CommandText = consulta

        ds_local.ListadoDevoluciones.Load(comando.ExecuteReader())

        conexion.Close()

        reporte.SetDataSource(ds_local)

        Me.crvInforme.ReportSource = reporte
        Me.crvInforme.Show()
        Me.crvInforme.Refresh()
    End Sub
End Class